<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:gb="http://giava.by/giavacms/base"
	xmlns:pe="http://primefaces.org/ui/extensions"
	xmlns:p="http://primefaces.org/ui" template="/WEB-INF/layout/t.xhtml">
	<ui:define name="bundle">
		<f:loadBundle basename="base" var="msg" />
	</ui:define>
	<ui:define name="title">
		<h:outputText value="#{msg['template.module.edit.title']}" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="template" />
	</ui:define>
	<ui:define name="content">
		<gb:upDown />
		<h:form prependId="false">

			<center>
				<p:panel header="#{msg['template.module.edit.title']}">

					<h:panelGrid columns="2" style="width: 50%">

						<h:outputLabel value="#{msg['template.edit.name']}" for="nome" />
						<h:inputText required="true" id="nome"
							value="#{templateController.element.name}" style="width: 100%;" />

						<h:outputLabel value="#{msg['template.edit.static.label']}"
							for="statico" escape="false" />
						<h:selectBooleanCheckbox id="statico"
							value="#{templateController.element.statico}" />

					</h:panelGrid>

					<br />
					<h:outputText value="#{msg['global.mandatory']}" />
					<br />
					<br />

					<p:panel header="#{msg['template.edit.header_start']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<p:inputTextarea
							value="#{templateController.element.header_start}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.header_start}"
							readOnly="false" lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.header_stop']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<h:outputText style="font-size: small;"
							value="#{msg['template.edit.static.notEditlabel']}" />
						<br />
						<p:inputTextarea value="#{templateController.element.header_stop}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.header_stop}"
							readOnly="false" lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.col1_start']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<p:inputTextarea value="#{templateController.element.col1_start}"
							style="color: black; width: 100%; " escape="false" />

						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.col1_start}" readOnly="false"
							lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.col1_stop']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<h:outputText style="font-size: small;"
							value="#{msg['template.edit.static.notEditlabel']}" />
						<br />
						<p:inputTextarea value="#{templateController.element.col1_stop}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.col1_stop}" readOnly="false"
							lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.col2_start']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<p:inputTextarea value="#{templateController.element.col2_start}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse"
							value="#{templateController.element.col2_start}" readOnly="false"
							lineNumbers="true" mode="xml" rendered="false" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.col2_stop']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<h:outputText style="font-size: small;"
							value="#{msg['template.edit.static.notEditlabel']}" />
						<br />
						<p:inputTextarea value="#{templateController.element.col2_stop}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.col2_stop}" readOnly="false"
							lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.col3_start']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<p:inputTextarea value="#{templateController.element.col3_start}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.col3_start}" readOnly="false"
							lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.col3_stop']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<h:outputText style="font-size: small;"
							value="#{msg['template.edit.static.notEditlabel']}" />
						<br />
						<p:inputTextarea value="#{templateController.element.col3_stop}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.col3_stop}" readOnly="false"
							lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.footer_start']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<p:inputTextarea
							value="#{templateController.element.footer_start}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.footer_start}"
							readOnly="false" lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

					<p:panel header="#{msg['template.edit.footer_stop']}"
						toggleable="true" toggleSpeed="500" closeSpeed="500">
						<h:outputText style="font-size: small;"
							value="#{msg['template.edit.static.notEditlabel']}" />
						<br />
						<p:inputTextarea value="#{templateController.element.footer_stop}"
							style="color: black; width: 100%; " escape="false" />
						<pe:codeMirror theme="eclipse" rendered="false"
							value="#{templateController.element.footer_stop}"
							readOnly="false" lineNumbers="true" mode="xml" />
					</p:panel>

					<br />
					<br />

				</p:panel>

				<br /> <br />

				<h:panelGrid columns="4">
					<h:commandButton action="#{templateController.save}"
						value="#{msg['global.save']}"
						rendered="#{empty templateController.element.id}" />

					<h:commandButton action="#{templateController.update}"
						value="#{msg['global.update']}"
						rendered="#{not empty templateController.element.id}" />

					<h:commandButton action="#{templateController.delete}"
						value="#{msg['global.delete']}" immediate="true"
						rendered="#{not empty templateController.element.id}"
						onclick="if (!confirm('#{msg['global.deleteMsg']}')) return false" />

					<h:commandButton id="del2"
						action="#{templateController.reallyDelete}"
						value="#{msg['global.reallyDelete']}" immediate="true"
						rendered="#{not empty templateController.element.id and loginController.admin}"
						onclick="if (!confirm('#{msg['global.reallyDeleteMsg']}')) return false" />

					<h:commandButton id="reset" action="#{templateController.reset}"
						value="#{msg['global.undo']}" immediate="true" />
				</h:panelGrid>
			</center>

		</h:form>
	</ui:define>
</ui:composition>